#ifndef __LUOO_CSV_READER_H__
#define __LUOO_CSV_READER_H__

#include <vector>
#include <fstream>

#include "csv_record.hpp"

namespace luoo
{
	class csv_reader
	{
	private:
		typedef std::vector<csv_record> csv_record_set;

	public:
		bool open(const char* file_name);
		csv_record& get_csv_record(size_t index);

		csv_reader& operator >> (csv_trash_type);
		csv_record& operator[](int row);

		size_t get_num_fields();
		size_t get_num_rows();

	private:
		bool parse(std::fstream& csv_file);
		bool parse_line(std::fstream& csv_file, csv_record& record);

	private:
		std::string csv_file_path_;
		csv_record_set csv_record_set_;
	};
}// namespace luoo

#endif//__LUOO_CSV_READER_H__